/*
 * @Description: 
 * @Author: zyj
 * @Date: 2022-05-27 17:15:52
 * @LastEditors: zyj
 * @LastEditTime: 2022-05-27 17:16:00
 */
/* 实现throttle */
function throttle(fn, wait) {
  let canRun = true;
  return function () {
    if (!canRun) return;
    canRun = false;
    setTimeout(() => {
      fn.call(this, arguments);
      canRun = true;
    }, wait);
  }
}
function say() {
  console.log('throttle');
}
window.addEventListener("resize", throttle(say, 1000));